package messages.registration;

import messages.BaseMessage;
import messages.MessageType;

public class ElevatorRegistrationMessage extends BaseMessage {

    private byte clientId = 0;
    
    public ElevatorRegistrationMessage(byte[] data)
    {
        super(data);
        
        this.clientId = data[1];
    }
    
    public ElevatorRegistrationMessage(byte clientId)
    {
        super(null);
        
        this.clientId = clientId;
    }

    @Override
    public byte[] toByteArray()
    {
        byte[] retVal = new byte[getMessageSize()];
        
        retVal[0] = getMessageType().getIdentifier();
        retVal[1] = this.clientId;
        
        return retVal;
    }

    @Override
    public MessageType getMessageType()
    {
        return MessageType.ElevatorRegistrationMessage;
    }
    
    public byte getClientId()
    {
        return clientId;
    }

    @Override
    public int getMessageSize()
    {
        return 2;
    }

}
